package com.qeado.content.dao.ibatis;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.qeado.common.dao.BaseDao;
import com.qeado.content.dao.ProductManageDao;
import com.qeado.content.model.BdTypeCode;
import com.qeado.content.model.KindTypeCode;
import com.qeado.content.model.Product;
import com.qeado.content.model.RkTypeCode;
import com.qeado.content.model.UnitTypeCode;

@Repository
@SuppressWarnings("unchecked")
public class ProductManageDaoImpl extends BaseDao implements ProductManageDao {

	@Override
	public List<Product> getProductListByCondition(Product p) {
		return getSqlMapClientTemplate().queryForList("getProductListByCondition",p);
	}

	@Override
	public void deleProductById(Product p) {

		getSqlMapClientTemplate().delete("deleProductById",p);
		
	}

	@Override
	public void insertNewProduct(Product p) {
		getSqlMapClientTemplate().insert("insertNewProduct",p);
		
	}

	@Override
	public Product searchProductById(String id) {
		Product p = new Product();
		p.setId(id);
		return (Product)getSqlMapClientTemplate().queryForObject("searchProductById",p);
	}

	@Override
	public List<BdTypeCode> getAllBrandTypeCode() {
		
		return getSqlMapClientTemplate().queryForList("getAllBrandTypeCode");
	}

	@Override
	public List<KindTypeCode> getAllKindTypeCode() {
		// TODO Auto-generated method stub
		return getSqlMapClientTemplate().queryForList("getAllKindTypeCode");
	}

	@Override
	public List<RkTypeCode> getAllRankTypeCode() {
		// TODO Auto-generated method stub
		return getSqlMapClientTemplate().queryForList("getAllRankTypeCode");
	}

	@Override
	public List<UnitTypeCode> getAllUnitTypeCode() {
		// TODO Auto-generated method stub
		return getSqlMapClientTemplate().queryForList("getAllUnitTypeCode");
	}

	@Override
	public void updateProduct(Product p) {
		getSqlMapClientTemplate().insert("updateProduct",p);
	}

	@Override
	public List<Map<String, String>> searchUserInfoFromProd(
			Map<String, String> map) {
		return getSqlMapClientTemplate().queryForList("searchUserInfoFromProd", map);
	}

}
